//
//  LZRequestVideoTask.h
//  laziz_Consumer
//
//  Created by xbnzd on 17/3/28.
//  Copyright © 2017年 XBN. All rights reserved.
//

#import <Foundation/Foundation.h>

@class LZRequestVideoTask;

@protocol LZRequestVideoTaskDelegate <NSObject>

- (void)taskDidReciveVideoLength:(NSUInteger)videoLength mimeType:(NSString *)mimeType task:(LZRequestVideoTask *)task;
- (void)taskDidReciveVideoDataWithTask:(LZRequestVideoTask *)task;
- (void)taskDidFinishLoadingWithTask:(LZRequestVideoTask *)task;
- (void)taskDidFailLoadingWithTask:(LZRequestVideoTask *)task withError:(NSInteger)errorCode;
- (void)taskStarLoadingWithProgress:(CGFloat)progress;

@end

@interface LZRequestVideoTask : NSObject
@property (nonatomic, weak)             id<LZRequestVideoTaskDelegate>lzRequestVideoTaskDelegate;
@property (nonatomic, assign) __block NSUInteger    wantDownLoadOffset; //准备从这里下载,有值,说明用户对视频播放进度有操作
@property (nonatomic, assign) NSUInteger    videoLength;
@property (nonatomic, assign) __block NSUInteger    currentDownLoadingOffset; //当前正在下载的量
@property (nonatomic, strong) NSString      *mimeType;
@property (nonatomic, strong) NSURL         *url;

/**
 下载视频片段

 @param url <#urlStr description#>
 @param offset <#offset description#>
 */
- (void)loadVideoWithURL:(NSURL *)url offset:(NSUInteger)offset;


/**
 取消下载
 */
- (void)cancel;


/**
 清除临时存储的数据
 */
- (void)clearTemporaryData;


@end
